﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LEET.StaticAnalisys;

namespace StaticAnalisys.Visitors
{
    public class CompositeVisitor : IVisitor
    {
        protected IList<IVisitor> visitors;

        public CompositeVisitor()
        {
            visitors = new List<IVisitor>();
        }

        public void Add(IVisitor visitor)
        {
            visitors.Add(visitor);
        }

        public void Visit(INode node)
        {
            foreach (IVisitor visitor in visitors)
                visitor.Visit(node);
        }
    }
}
